// Copyright DustedPixels.com 2008. All rights reserved.

package kroff;

import com.dustedpixels.asm.Inline;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class KroffUnit implements Runnable {
  @Inline private final Pin signal1;
  @Inline private final Pin signal2;
  @Inline private final Pin signal3;
  @Inline private final Runnable oscillator;
  @Inline private final Runnable andGate;
  @Inline private final Runnable notGate;

  public KroffUnit() {
    this.signal1 = new Pin();
    this.signal2 = new Pin();
    this.signal3 = new Pin();
    
    this.oscillator = new Oscillator(signal1);
    this.andGate = new AndGate(signal1, signal3, signal2);
    this.notGate = new NotGate(signal2, signal3);
  }
  
  public void run() {
    oscillator.run();
    andGate.run();
    notGate.run();
  }
}
